(function() {
    "use strict";
    var e = window.jQuery,
        t = window.qh360cp,
        n = window._,
        r = {
            start: function() {
                this.setFilteroptions();
                var n = this;
                this.table = e("#conditionList"), this.syncModel(this.getSrcdata()), e("ul.boll-list li .btn-boll").click(function() {
                    e(this).hasClass("btn-boll-active") ? e(this).removeClass("btn-boll-active") : (e(this).addClass("btn-boll-active"), n.options.Cbox = e(this)), n.syncModel(n.getSrcdata())
                }), e(".chbox").click(function() {
                    e(this).hasClass("chbox-s") ? e(this).removeClass("chbox-s") : e(this).addClass("chbox-s")
                }), e("#filter_options .o_div h3").click(function() {
                    var t = e(this).parent().index();
                    n.options.selectedIndex !== null && n.options.selectedIndex != t && (e("#filter_options .o_div:eq(" + n.options.selectedIndex + ") h3").removeClass("on"), e("#filter_options .o_div:eq(" + n.options.selectedIndex + ") ul").hide(), n.options.selectedIndex = null), e(this).hasClass("on") ? (e(this).removeClass("on"), e(this).next().hide()) : (e(this).addClass("on"), e(this).next().show(), n.options.selectedIndex = t)
                }), e("#filter_options .o_div ul li").click(function() {
                    var t = e(this).attr("cName");
                    t ? t = [t] : t = e(this).parent().find("li[cName]").map(function(t, n) {
                        return e(n).attr("cName")
                    }), n.addGroup(t)
                }), e(".clearHao").click(function() {
                    var t = e(this).parents(".ht").attr("atdiv");
                    e("#" + t).find(".btn-boll").removeClass("btn-boll-active"), n.syncModel(n.getSrcdata())
                }), e(".allHao").click(function() {
                    n.allHao(this)
                }), e(".sd_clearHao").click(function() {
                    var t = e(this).parents(".ht").next();
                    if (t.attr("id") == undefined || t.attr("id") == "") t = t.next();
                    t.find("label .boll").each(function() {
                        e(this).attr("class", "boll")
                    })
                }), e(".sd_allHao").click(function() {
                    var t = e(this).parents(".ht").next(),
                        n = "redboll";
                    if (t.attr("id") == undefined || t.attr("id") == "") t = t.next();
                    t.attr("id") == "blue_sdlist" && (n = "blueboll"), t.find("label .boll").each(function() {
                        e(this).addClass(n)
                    })
                }), e(".ppAll").click(function() {
                    e("#" + n.options.tipType + "chkValuelist label:visible input").each(function() {
                        this.checked = !0
                    })
                }), e(".ppFang").click(function() {
                    e("#" + n.options.tipType + "chkValuelist  label:visible input").each(function() {
                        this.checked ? this.checked = !1 : this.checked = !0
                    })
                }), this.table.delegate("input.o_del", "click", function() {
                    n.deleteCondition(e(this).parents("tr"))
                }).delegate(".new_x", "click", function() {
                    n.deleteGroup(this.parentNode.parentNode)
                }).delegate("input.al_err", "click", function() {
                    n.resetGroupErr(e(this).parents("tbody"))
                }).delegate("input.coolgl", "click", function() {
                    n.options.setBtn = this;
                    var t = e(this).parents("tr").attr("condition");
                    n.options.codeTipId = t + "Dlg", n.options.tipType = t, n.initCoolBtn(t, e(this).data("codes")), n.openDlg("#" + n.options.codeTipId)
                }).delegate("input.setdan", "click", function() {
                    n.resetNoFilter(e(this).parents("tbody").attr("sort-index"))
                }).delegate(":text", "keyup", function(t) {
                    var r = n.inputNum(this);
                    r && n.resetNoFilter(e(this).parents("tbody").attr("sort-index"))
                }).delegate(":text", "focus", function() {
                    var e = this;
                    setTimeout(function() {
                        e.select()
                    }, 100)
                }).delegate(":text", "blur", function() {
                    var t = parseFloat(this.value) || 0,
                        n = e(this).attr("isint") == 1;
                    this.oldPrev = this.value = t == 0 ? n ? 1 : 0 : n ? t : t.toFixed(2)
                }).delegate("select", "change", function() {
                    n.resetNoFilter(e(this).parents("tbody").attr("sort-index"))
                }).delegate(".exp", "click", function() {
                    var t = e(this).parents(".stepbody");
                    e(this).hasClass("on") ? (t.find("tr:gt(0)").hide(), e(this).removeClass("on")) : (t.find("tr:gt(0)").show(), e(this).addClass("on"))
                }).delegate(".ssSelect", "change", function() {
                    var t = this.options.selectedIndex,
                        n = e(this).attr("sstext").split("|")[t];
                    e(this).parent().find(".ssText").html(n)
                }), e("#do_filter").click(function() {
                    n.doFilter()
                }), e("#claer_condition").click(function() {
                    n.clear()
                }), e("#beshu").keyup(function() {
                    n.inputNum(this), n.needmoney(this.value * 2 * e("#new_zs").html())
                }).blur(function() {
                    e(this).val() == 0 && (this.oldPrev = this.value = 1, n.needmoney(this.value * 2 * e("#new_zs").html()))
                }), e("#reducebe").click(function() {
                    var t = e("#beshu")[0],
                        r = e(t).val();
                    r != 1 && (r = --r, e(t).val(r), t.oldPrev = r, n.needmoney(r * 2 * e("#new_zs").html()))
                }), e("#addbe").click(function() {
                    var t = e("#beshu")[0],
                        r = e(t).val();
                    r = ++r, e(t).val(r), t.oldPrev = r, n.needmoney(r * 2 * e("#new_zs").html())
                }), e(".new_tips_box .close").click(function() {
                    n.closeCool()
                }), e(".new_tips_box .btn_save").click(function() {
                    var r = n.saveTipsValue(this),
                        i = n.options.setBtn;
                    e(i).data("codes", r), e(i).parents("tr").data("codes", r);
                    var s = !0;
                    if (!r) {
                        e(i).parents("tr").find("input.cool_txt").val("\u8bf7\u70b9\u51fb\u8bbe\u7f6e\u6309\u94ae\u8bbe\u5b9a\u6761\u4ef6").addClass("error");
                        return
                    }
                    if (!r.p.set) e(i).parents("tr").find("input.cool_txt").val("\u9009\u62e9\u503c\uff1a" + r.text).removeClass("error");
                    else {
                        var o = r.p.set.length;
                        o == 0 ? (e(i).parents("tr").find("input.cool_txt").val("\u8bf7\u70b9\u51fb\u8bbe\u7f6e\u6309\u94ae\u8bbe\u5b9a\u6761\u4ef6").addClass("error"), s = !1) : e(i).parents("tr").find("input.cool_txt").val("\u5171\u8bbe\u7f6e\u4e86" + o + "\u4e2a\u6761\u4ef6").removeClass("error")
                    }
                    s ? (n.resetNoFilter(e(i).parents("tbody").attr("sort-index")), n.closeCool()) : t.lightbox.alert({
                        content: "\u5bf9\u4e0d\u8d77\uff0c\u60a8\u8fd8\u6ca1\u6709\u6dfb\u52a0\u6761\u4ef6",
                        on_focus: ".lightbox_confirm"
                    })
                }), e(".new_tips_box .btn_delitems").click(function() {
                    n.deleteList()
                }), e(".new_tips_box .btn_additem").click(function() {
                    n.addItem(n.getCode())
                }), e(".new_tips_box .btn_change").click(function() {
                    n.options.codeli && (n.addItem(n.getCode(), n.options.codeli), e("#" + n.options.codeli).removeClass("selected"), n.options.codeli = null)
                }), e(".code_list").delegate("li", "mouseover", function() {
                    e(this).addClass("on")
                }).delegate("li", "mouseout", function() {
                    e(this).removeClass("on")
                }).delegate("li", "click", function() {
                    e(this).siblings().removeClass("selected"), e(this).addClass("selected");
                    var t = e(this).data("code");
                    n.options.codeli = e(this).attr("id"), n.setChangeli(t);
                    return
                }).delegate("a.del", "click", function(e) {
                    e = e || window.event, e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0, n.deleteItem(this.parentNode)
                }), e(".playTypeRadio input").each(function(t) {
                    e(this).click(function() {
                        n.options.zuxuan = e(this).val() * 1;
                        var t = n.options.zuxuan > 0 ? 1 : 0;
                        e(".sdPlayDiv").hide().find("ul").removeAttr("id"), e(".sdPlayDiv").eq(t).show().find("ul").attr("id", "redboxlist").find(".btn-boll-active").removeClass("btn-boll-active"), n.changePlayType(), n.syncModel(n.getSrcdata()), n.clear()
                    })
                }), e("select.mapIdselect").click(function() {
                    var t = e(this).val();
                    e(this).find("option").each(function() {
                        var n = e(this).attr("value");
                        n != t && (e("#" + n + "Select").hide(), e("#" + n + "Select").find("input").each(function() {
                            this.checked = !1
                        }))
                    }), e("#" + t + "Select").show()
                }), e("#cgfzType").change(function() {
                    var t = e(this).parent().find(".range"),
                        r = e.trim(e(this).val());
                    r == "zdjj" || r == "zxjj" || r == "lh" || r == "lhz" || r == "jh" || r == "jhlx" || r == "dh" || r == "dhlx" || r.indexOf("qhz") > 0 ? e("#cgfzDlg .bq").attr("disabled", !0).attr("checked", !1) : e("#cgfzDlg .bq").attr("disabled", !1);
                    var i = [],
                        s = 0;
                    e("#cgfzDlg .cgfzValue").each(function() {
                        this.disabled || i.push(this.checked), this.checked && s++
                    }), n.initValue(t, r, 1), t.find("select").change()
                }), e("#cgfzAll").click(function() {
                    e("#" + n.options.codeTipId).find(".cgfzValue").each(function() {
                        this.checked = !0
                    })
                }), e("#cgfzClear").click(function() {
                    e("#" + n.options.codeTipId).find(".cgfzValue").each(function() {
                        this.checked = !1
                    })
                }), e("#sedanDlg .shedan-list input").change(function() {
                    var t = e(this).parents(".shedan-list"),
                        n = t.find("input:checked");
                    t.find("select").val(n.length)
                }), e("#show_all").click(function() {
                    n.showJG()
                }), e("#jg_ok").click(function() {
                    n.closeMask(), e("#jgDlg").hide()
                }), e(".new_tips_box .val1").each(function() {
                    var t = this,
                        r = e(this).siblings(".val2");
                    n.compareValue(t, r)
                }), e("#show_fenbu").click(function() {
                    n.fenbu()
                }), e("#show_compare").click(function() {
                    n.showCompare()
                }), t.pages.hm.init(), e("#do_hm").click(function() {
                    n.showHm()
                }), e("#hmBuy").click(function() {
                    n.doHm()
                }), e("#do_dg").click(function() {
                    n.doBuy()
                }), e("#addModel").click(function() {
                    n.showModelview()
                }), e("#viewModel").click(function() {
                    n.showModelviewList()
                });
                var r;
                e(".tips").hover(function() {
                    var n = {};
                    n.content = e(this).attr("tips"), n.offset_box = this, n.width = 240, n.direction = e(this).attr("talign"), n.direction ? n.left = -250 : n.left = -35, r = t.lightbox.tips(n)
                }, function() {
                    r && r.close()
                }), n.mouseMove(".new_tips_box", ".tips_title"), n.options.isover = !1;
                var i = e("#end_time"),
                    s = parseInt(i.attr("data-endtime")),
                    o = parseInt(i.attr("data-servertime")),
                    u = setInterval(function() {
                        o += 1e3;
                        var r = s - o;
                        if (r <= 0) {
                            n.options.isover = !0, i.html("\u5df2\u622a\u6b62"), clearInterval(u);
                            var a = "\u60a8\u597d, " + e(".qici").text() + "\u7684\u6295\u6ce8\u5df2\u7ed3\u675f";
                            n.options.mwh || (a += "\uff0c\u8bf7\u91cd\u65b0\u5237\u65b0\u9875\u9762\u8fdb\u5165\u4e0b\u4e00\u671f\u6295\u6ce8!"), t.lightbox.alert({
                                content: a,
                                confirm_callback: function() {}
                            })
                        } else {
                            r = parseInt(r / 1e3);
                            var f = parseInt(r / 86400);
                            r -= f * 86400;
                            var l = parseInt(r / 3600);
                            r -= l * 3600;
                            var c = parseInt(r / 60);
                            r -= c * 60, i.html(f + "\u5929" + l + "\u5c0f\u65f6" + c + "\u5206\u949f" + r + "\u79d2")
                        }
                    }, 1e3);
                e("#changeLot").hover(function() {
                    e(this).find(".lot-pop").show()
                }, function() {
                    e(this).find(".lot-pop").hide()
                })
            }
        };
    e.extend(t.QFilter, r)
})();